package com.finance.report.bean.pojo;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.finance.framework.lang.BaseObject;
import lombok.Data;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

/**
 * Created by Administrator on 2017/5/3.
 */
@Data
public class LogisticsErrorLog extends BaseObject {
    Logger logger = LoggerFactory.getLogger(this.getClass());
    private String waybillNum;
    private String requestLogInfo;
    private String errorReason;
    private String errorType;
    private String month;

    public LogisticsData getLogisticsData(){
        ObjectMapper objectMapper = new ObjectMapper();
        if(StringUtils.isBlank(requestLogInfo)) {
            return null;
        }
        try {
            LogisticsData logisticsData = objectMapper.readValue(this.requestLogInfo,LogisticsData.class);
            return logisticsData;
        } catch (IOException e) {
            logger.error(e.getMessage(),e);
            return  null;
        }
    }
}
